import java.util.Scanner;
import java.util.HashSet;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.nextLine();
        String s2 = in.nextLine();
        func(s1, s2);
    }
    public static void func(String s1, String s2){
        s1 = s1.toUpperCase();
        s2 = s2.toUpperCase(); //全部转换成大写, 方便比较和输出
        String ret;
        HashSet<Character> set = new HashSet<>();
        for(int i = 0; i < s2.length(); i++){
           char ch = s2.charAt(i);  //把实际被输入的字符串放在set中
           set.add(ch);
        }
        for(int i = 0; i < s1.length(); i++){
            char ch = s1.charAt(i);
            if(!set.contains(ch)){
                System.out.print(ch);
                set.add(ch);
            }
        }
    }
}